<template>
  <a-modal
    :visible="visible"
    title="编辑投资完成"
    cancelText="取消"
    okText="提交"
    @ok="submit"
    @cancel="cancel"
  >
    <a-form
      ref="formRef"
      :model="formState"
    >
      <a-form-item ref="wh" label="年月" name="wh">
        <a-input v-model:value="formState.wh" />
      </a-form-item>
      <a-form-item ref="wh" label="本月计划投资额（万元）" name="wh">
        <a-input v-model:value="formState.wh" />
      </a-form-item>
      <a-form-item ref="wh" label="本月完成投资额（万元）" name="wh">
        <a-input v-model:value="formState.wh" />
      </a-form-item>
      <a-form-item ref="wh" label="累计完成投资额（万元）" name="wh">
        <a-input v-model:value="formState.wh" />
      </a-form-item>
      <a-form-item ref="wh" label="备注" name="wh">
        <a-textarea v-model:value="formState.wh" />
      </a-form-item>

    </a-form>
  </a-modal>
</template>
<script>
import { defineComponent, reactive, ref } from "vue";
const previewFile = async file => {
  console.log('Your upload file:', file);
  // Your process logic. Here we just mock to the same file
  const res = await fetch('https://next.json-generator.com/api/json/get/4ytyBoLK8', {
    method: 'POST',
    body: file,
  });
  const {
    thumbnail,
  } = await res.json();
  return thumbnail;
};
const fileList = ref([]);
export default defineComponent({
  props: {
    visible: {
      type: Boolean,
    },
  },
  emit: ["close"],
  setup(props, context) {
    const formRef = ref();

    const formState = reactive({
      sort: 0,
      enable: "true",
    });

    const formRules = {
      name: [{ required: true, message: "请输入岗位名称", trigger: "blur" }],
      code: [{ required: true, message: "请输入岗位编号", trigger: "blur" }],
    };

    const saveKey = "save";

    const submit = (e) => {

    };

    const cancel = (e) => {
      context.emit("close", false);
    };

    const tokenKey = localStorage.getItem("token_key");
    const token = localStorage.getItem("token")

    const headers = {
      "Authorization": token,
      "Authorization-key": tokenKey
    };

    return {
      submit,
      cancel,
      headers,
      formRef,
      formState,
      formRules,

      labelCol: { span: 6 },
      wrapperCol: { span: 18 },
    };
  },
});
</script>
